import request from "@/util/request";

/** 此处后端没有提供注释 GET /user */
export async function deleteUser(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.deleteUserParams,
  options?: { [key: string]: any }
) {
  return request<API.Result>("/user", {
    method: "GET",
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 此处后端没有提供注释 GET /user/get/login */
export async function getLoginUser(options?: { [key: string]: any }) {
  return request<API.ResultUserVo>("/user/get/login", {
    method: "GET",
    ...(options || {}),
  });
}

/** 此处后端没有提供注释 POST /user/login */
export async function login(
  body: API.UserLoginDTO,
  options?: { [key: string]: any }
) {
  return request<API.ResultUserVo>("/user/login", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

/** 此处后端没有提供注释 GET /user/logout */
export async function logout(options?: { [key: string]: any }) {
  return request<API.Result>("/user/logout", {
    method: "GET",
    ...(options || {}),
  });
}

/** 此处后端没有提供注释 POST /user/query/all */
export async function queryAll(
  body: API.UserQueryDTO,
  options?: { [key: string]: any }
) {
  return request<API.ResultResultPageUserVo>("/user/query/all", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

/** 此处后端没有提供注释 GET /user/query/one/${param0} */
export async function queryOneById(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.queryOneByIdParams,
  options?: { [key: string]: any }
) {
  const { id: param0, ...queryParams } = params;
  return request<API.ResultUserVo>(`/user/query/one/${param0}`, {
    method: "GET",
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 此处后端没有提供注释 POST /user/register */
export async function register(
  body: API.UserRegisterDTO,
  options?: { [key: string]: any }
) {
  return request<API.ResultUserVo>("/user/register", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

/** 此处后端没有提供注释 POST /user/update */
export async function update(
  body: API.UserUpdateDTO,
  options?: { [key: string]: any }
) {
  return request<API.Result>("/user/update", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}
